﻿// zxCheckProjectPropertyCtrl.cpp: 实现文件
//

#include "stdafx.h"
//#include "zChecker.h"
#include "zxCheckProjectPropertyCtrl.h"


// zxCheckProjectPropertyCtrl

IMPLEMENT_DYNAMIC(zxCheckProjectPropertyCtrl, CMFCPropertyGridCtrl)

zxCheckProjectPropertyCtrl::zxCheckProjectPropertyCtrl()
{

}

zxCheckProjectPropertyCtrl::~zxCheckProjectPropertyCtrl()
{
}


BEGIN_MESSAGE_MAP(zxCheckProjectPropertyCtrl, CMFCPropertyGridCtrl)
	ON_WM_CREATE()
END_MESSAGE_MAP()



// zxCheckProjectPropertyCtrl 消息处理程序

int zxCheckProjectPropertyCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CMFCPropertyGridCtrl::OnCreate(lpCreateStruct) == -1)
		return -1;

	// TODO:  在此添加您专用的创建代码

	return 0;
}



void zxCheckProjectPropertyCtrl::Populate(ck::CheckProject* pProject)
{
	this->RemoveAll();

	//z_uint32 id = pProject->GetID();
	z_uint32 code = pProject->GetCode();
	//const char* szCode = "";// pProject->GetSCode();
	const char* szName = pProject->GetName();
	const char* szDescription = ""; //pProject->GetDescription();

	char szCode[Z_NAME_MAX];
	sprintf(szCode, "%d", code);

	ck::CheckCase* pCheckCase = NULL;
	pCheckCase = pProject->GetCheckCase();

	CMFCPropertyGridProperty* pProjGroup = new CMFCPropertyGridProperty(_T("检查工程"));
	pProjGroup->AddSubItem(new CMFCPropertyGridProperty("工程名称", (_variant_t)szName, _T("")));
	pProjGroup->AddSubItem(new CMFCPropertyGridProperty("工程编码", (_variant_t)szCode, _T("")));
	pProjGroup->AddSubItem(new CMFCPropertyGridProperty("工程说明", (_variant_t)szDescription, _T("")));

	this->AddProperty(pProjGroup);

	CMFCPropertyGridProperty* pCaseGroup = new CMFCPropertyGridProperty(_T("检查方案"));
	if (pCheckCase)
	{
		z_uint32 caseID = pCheckCase->GetID();
		z_uint32 caseCode = pCheckCase->GetCode();
		const char* szCaseCode = pCheckCase->GetSCode();
		const char* szCaseName = pCheckCase->GetName();
		const char* szCaseDescription = pCheckCase->GetDescription();

		pCaseGroup->AddSubItem(new CMFCPropertyGridProperty("方案名称", (_variant_t)szCaseName, _T("")));
		pCaseGroup->AddSubItem(new CMFCPropertyGridProperty("方案编码", (_variant_t)szCaseCode, _T("")));
		pCaseGroup->AddSubItem(new CMFCPropertyGridProperty("方案说明", (_variant_t)szCaseDescription, _T("")));
	}
	this->AddProperty(pCaseGroup);

}
